package wodegua.d2_demo;

import java.util.Random;

public class Code {
    public static void main(String[] args) {
        System.out.println(createCode(4));
        System.out.println(createCode(6));
    }

    public static String createCode(int number){
        String code = "";
        String codeStr = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";

        Random random = new Random();
        for (int i = 0; i < number; i++) {
            code += codeStr.charAt(random.nextInt(codeStr.length()));
        }
        return code;
    }
}
